"19:45:24, 19 April 2003: Compressing sources...."!
Object comment:
'Object is the abstract root of the standard Smalltalk class hierarchy. It has no instance variables (indeed it must not have any), but provides behavior common to all objects.
Instance Variables:
<MUST BE NONE>
Class Variables:
_AssertionFailureSignal <Signal> raised when assertion failures occur (see #assert:)
_DependentsRegister <WeakIdentityDictionary> containing DependentsCollections for instances
_EventsRegister <WeakIdentityDictionary> containing EventsCollections for instances
_FinalizeMask <Integer> bit mask to set/reset the finalize mark of instances
The following Instance specific behaviour mask constants are held in the PoolConstantsDictionary _InstanceBehaviorMasks in order that they may be readily shared into user defined root classes.
_GetSpecialMask <Integer> bit mask to retrieve special behavior flags of instances
_PropertyRegister <PropertyManager> Register of instance specific information not stored in instance variables
_WeakMask <Integer> bit mask to use to set/reset the weak mark of instances
Note: All class variables beginning with $_ are private to the implementation. This convention is adopted to avoid potential name clashes with user defined classes.
Object implements the ANSI protocol <Object> (browse the protocols-Object category).
The following messages defined in Object have optimized implementations inlined by the Compiler and cannot be overridden:
#==
#basicAt: (overridable if subclass not indexable)
#basicAt:put: (ditto)
#basicSize
#basicClass
#isNil
#notNil
In addition any selector in Object with a ''basic'' prefix may be subject to inlining in future releases, so these should not be overridden.
'!
!Object class methodsFor!
_eventsRegister
"Private - Answer the register of events"
^_EventsRegister!
binaryReadFrom: aStream
"Answers an object read from its binary representation on aStream.
This must have been saved using Object>>binaryStoreOn:"
^self binaryReadFrom: aStream context: nil
!
binaryReadFrom: aStream context: anObject
"Answers an object read from its binary representation on aStream.
This must have been saved using Object>>binaryStoreOn:"
^(STBInFiler on: aStream) context: anObject; next.!
fromBinaryStoreBytes: aByteArray
"Answers an object read from its binary representation in aByteArray.
This must have been created using Object>>binaryStoreBytes"
when: anEventSymbol send: aSelector to: anObject with: anArgument
"Register an event handler such that when the receiver triggers the event
anEventSymbol, the keyword selector, aSelector, is sent to anObject with the
single argument, anArgument."
self when: anEventSymbol
perform: (EventMessageSend
receiver: anObject
selector: aSelector
argument: anArgument)!
when: anEventSymbol send: aSelector to: anObject withArguments: anArray
"Register an event handler such that when the receiver triggers the event
anEventSymbol, the multi-keyword selector aSelector is sent to anObject with arguments
from anArray."
self when: anEventSymbol
perform: (EventMessageSend
receiver: anObject
selector: aSelector
arguments: anArray)!
when: anEventSymbol sendTo: anObject
"Register an event handler such that when the receiver triggers the event
anEventSymbol, it is sent as a unary selector to anObject."
self
when: anEventSymbol
send: anEventSymbol
to: anObject!
yourAddress
"Answer the address of the body of the receiver. The primitive does not fail.
The answer (an Integer) can be passed to external procedures as a pointer
or stored into another byte object representing a structure as a member pointer,
and call also be mutated (using #becomeA(n):) into a byte object such as ExternalAddress.
Although the primitive does not fail for non-byte objects, it is potentially unsafe
to access these indirectly, almost certainly an error to pass their address to
external procedures, and very likely to cause unexpected behaviour if used to modify
the contents of the object.
When taking the address of an object, you are entering the unprotected realms
of pointer manipulation, and need to be aware of object lifetime issues. In particular
be careful not to pass the address of a temporary object to a third party which is
intending to keep hold of that address, as the address will become invalid if the
object is garbage collected. In addition, if the third party writes off the front or end
of the object, it may corrupt the Smalltalk image, and cause unexpected behavior.
It is often better to use an external buffer, outside the Smalltalk object space, and
manage its lifetime yourself."
<primitive: 103>
^self primitiveFailed!
yourself
"Answer the receiver (useful for returning the receiver from a cascaded message)."
^self
! !
ProtoObject comment:
'ProtoObject is an abstract class that can be used as a basis for creating a variety of "stub" subclasses. It supplies the minimum protocol that might be useful for any such stub in order that inspection and debugging may successfully take place.'!
!ProtoObject class methodsFor!
publishedAspects
"Answer a <LookupTable> of the <Aspect>s published by the receiver.
Overridden by subclasses to add the aspects published locally"
'This class forms part of a tutorial for the Dolphin Beginner''s Guide. An Animal represents a potential guess in the animal guessing game. Animal instances are always the leaf nodes in the game''s knowledge tree which is held in the class variable, KnowledgeBase. The main part of the tree is built from instances of Question.
The game can be played by a evaluating:
Animal playGame.
The knowledge base is initially set up in Animal>>initialize to only know about a single animal; a dog. This method can be re-executed at any point to reset the knowledge tree to its starting point:
"Private - Initialize the name of the receiver to aString"
name := aStringName!
printOn: aStream
"Answer the name of the receiver as a developer would wish to see it ."
super printOn: aStream.
aStream nextPut: $(.
self displayOn: aStream.
aStream nextPut: $).! !
AttributeDescriptor comment:
'AttributeDescriptor is an abstract class of meta-objects that be used to describe the shape of other objects. It has a subclass, Aspect, instances of which describe how to access object''s published ''aspects'' (e.g. instance variables) through getter and setter methods, and a subclass, ExternalField, instances of which describe the fields of C style structures. Note that these objects are all descriptors, and need to be combined with a subject object in order to become "closed".'!
!AttributeDescriptor class methodsFor!
inaccessible
"Private - Answer an instance of the receiver which describes an attribute
which is neither writable nor readable."
^self new beInaccessible
!
initialize
"Private - Initialize class variables of the receiver.
AttributeDescriptor initialize
"
ReadableMask := 16r1.
WriteableMask := 16r2.
AccessorMask := 16r4.
MutatorMask := 16r8.
OverrideMask := 16r10.
MutableMask := 16r20.
NullableMask := 16r40!
new
"Answer an instance of the receiver which describes an attribute
which can be both read from and written to."
^super new initialize!
readOnly
"Answer an instance of the receiver which describes an attribute
which cannot be set."
^self new beReadOnly!
uncompiled
"Answer an instance of the receiver which describes a field which will not be compiled."
^self new beUncompiled!
writeOnly
"Answer an instance of the receiver which describes an attribute
which cannot be read, only written."
^self new beWriteOnly! !
!AttributeDescriptor methodsFor!
beCompiled
"Set the receiver's flags to specify it as an compiled attribute
(i.e. one with compiled accessors to retrieve/set its value).
'AXTypeInfoAnalyzer is a class which wraps an Active-X Automation <ITypeInfo> interface pointer and adds higher level behaviours for analyzing the type information available through that interface.
ITypeInfo itself contains a large number of member functions which allow one to enquire about the structure and attributes of each of the individual elements of a Type Library. Unfortunately it is rather poorly factored in that a single interface is used to describe widely differing objects. We have therefore applied the "Conditional Elimination" refactoring pattern and created a pseudo hierarchy as follows:
- TYPEKIND_ENUM TKindEnumAnalyzer an enumerated type
- TYPEKIND_RECORD TKindRecordAnalyzer a C-style struct
- TYPEKIND_MODULE TKindModule a shared library/DLL of static functions and constants
- TYPEKIND_INTERFACE TKindInterfaceAnalyzer a custom COM interface
- TYPEKIND_DISPATCH TKindDispatchAnalyzer an Active-X Automation interface
- TYPEKIND_COCLASS TKindCoclassAnalyzer an instantiable component class with a CLSID
- TYPEKIND_ALIAS TKindAliasAnalyzer a C-style typedef which defines a name for a type
- TYPEKIND_UNION TKindUnionAnalyzer a C-style union (struct with overlapping members)
Each subclass contains specific behaviours appropriate for querying relevant information for its particular type kind, and also for generating Smalltalk wrappers for that type.
Instance Variables:
piTypeInfo <ITypeInfo>. Interface onto type library information relevant to this type element.
typeLib <AXTypeLibraryAnalyzer>. Owning type library.
globalBinding <Association>. The global binding being generated, usually a Class.
generationFlags <integer>. Flags controlling the generation process.